package com.kt.util;

import com.kt.pojo.Admin;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * Description: 操作员工具类
 * Created with IntelliJ IDEA.
 *
 * @author: KamTeng
 * Date: 2021/2/23
 */
public class AdminUtils {

    /**
     * 获取当前登录操作员
     *
     * @return
     */
    public static Admin getCurrentAdmin() {
        // 获取全局上下文，获取用户。
        return (Admin) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
    }
}